{extend name='public/base'/}
{block name='header'}{/block} {//关掉头部}
{block name='menu'}{/block} {//关掉菜单}
{block name='seo'}
<title>{$title|default="标题"}</title>
<meta name="keywords" content="{$keywords|default='关键字'}">
<meta name="description" content="{$desc|default='描述'}">
{/block}

{block name='content'}
<article class="cl pd-20">

    <form action="" method="post" class="form form-horizontal" id="form-notice-edit">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>标题：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="{$notice_info.title}"  placeholder="" id="title" name="title">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>描述：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" autocomplete="off" value="{$notice_info.description}"  placeholder="" id="description" name="description">
            </div>
        </div>


        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>内容：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <textarea rows="7" cols="60" id="content" name="content" style="text-indent: 2em">
                    {$notice_info.content}
                </textarea>
            </div>
        </div>

        <div class="row cl">
<!--            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>发表人：</label>-->
            <div class="formControls col-xs-8 col-sm-9">
                <input type="hidden" class="input-text" value="{$Think.session.user_info.name}"  placeholder="" id="creater" name="creater">
            </div>
        </div>

        <!--将当前记录的id做为隐藏域发送到服务器-->
        <input type="hidden" value="{$notice_info.id}" name="id">

        {eq name="$Think.session.user_info.role" value="0"}
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius disabled" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" id="submit" >
            </div>
        </div>
        {/eq}
    </form>


</article>
{/block}

{block name='js'}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__STATIC__/lib/jquery.validation/1.14.0/messages_zh.js"></script>




<script>

    $(function(){
        //当用户修改了输入框内容时才触发
        $("form").children().change(function(){
            $("#submit").removeClass('disabled');
        });


        //ajax方式提交当前表单数据
        $("#submit").on("click", function(event){
            $.ajax({
                type: "POST",
                url: "{:url('notice/editNotice')}",
                data: $("#form-notice-edit").serialize(),
                dataType: "json",
                success: function(data){
                    if (data.status == 1) {
                        alert(data.message);

                    } else {
                        alert(data.message);

                    }
                }
            });

        })
    })
</script>
{/block}

</body>
</html>